import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import {VxeFormItemProps, VxeGridPropTypes} from "@/components/VxeTable";



/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: '车间名称',
    field: 'cheJianName',
    showOverflow: 'title',
    width: 120,
    align: 'center',
  },
  {
    title: '部门名称',
    field: 'deptName',
    showOverflow: 'title',
    width: 110,
    align: 'center',
  },
  {
    title: '小组名称',
    field: 'groupName',
    align: 'center',
    width: 120,
  },
  {
    title: '小组长',
    field: 'groupUserName',
    align: 'center',
    width: 130,
  },
  {
    title: '大组长',
    field: 'groupUserName2',
    align: 'center',
    width: 130,
  },
  {
    title: '领导',
    field: 'manageUserName',
    align: 'center',
    width: 130,
  },
  {
    title: '领导跳过审批',
    field: 'manageSkip',
    align: 'center',
    formatter: ({ cellValue, row, column }) => {
      const manageSkip = cellValue;
      let text = '';
      switch (manageSkip) {
        case 0:
          text = '否';
          break;
        case 1:
          text = '是';
          break;
      }
      return text;
    },
    width: 90,
  },

  {
    title: '备注',
    field: 'remark',
    align: 'center',
    width: 90,
  },
  {
    title: '创建时间',
    field: 'createTime',
    width: 130,
    align: 'center',
  },
  {
    width: 100,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];




export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 15,
    field: 'keyword',
    title: '搜索',
    itemRender: {
      props: {
        placeholder: '名称',
      },
      name: 'AInput',
    },
  },

  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];


export const formSchema: FormSchema[] = [

  {
    field: 'cheJianName',
    label: '车间名称',
    component:"Select",
    componentProps:{
      options:[
        {label:"DKL车间",value:"DKL车间"},
        {label:"钟车间",value:"钟车间"},
        {label:"OEM车间",value:"OEM车间"},
        {label:"钢壳厂",value:"钢壳厂"},
        {label:"表壳厂",value:"表壳厂"},
      ]
    },
    required: true,
  },
  {
    field: 'groupName',
    label: '小组名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'deptId',
    label: 'deptId',
  },
  {
    field: 'groupUserId',
    label: 'groupUserId',
  },
  {
    field: 'groupUserId2',
    label: 'groupUserId2',
  },
  {
    field: 'manageUserId',
    label: 'manageUserId',
  },
  {
    field: 'deptName',
    label: '部门',
    slot: "deptName",
    required: true
  },

  {
    label: '组长',
    field: 'groupUserName',
    slot: 'groupUserNameSlot',
  },
  {
    label: '大组长',
    field: 'groupUserName2',
    slot: 'groupUserNameSlot',
  },
  {
    label: '领导',
    field: 'manageUserName',
    slot: 'manageUserNameSlot',
  },
  {
    field: 'manageSkip',
    label: '领导跳过审批',
    component:"Select",
    componentProps:{
      options:[
        {label:"否",value:0},
        {label:"是",value:1},
      ]
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'Input',
  },
];
